package meatslope2.gameengine.gameobjects;

import meatslope2.application.R;
import meatslope2.constants.BitmapConstants;
import meatslope2.gameengine.components.CollisionComponent;
import meatslope2.gameengine.components.Component;
import meatslope2.gameengine.engine.Engine.Time;
import meatslope2.gameengine.primatives.Vector2;

public class Player extends GameObject
{	
	private final static float MAX_GRAVITY = -60f;
	
	public Vector2 getPrevPosition()
	{
		return this.prevPosition;
	}
	
    public Player()
    {
    	super(R.drawable.super_mario, BitmapConstants.PLAYER_WIDTH, BitmapConstants.PLAYER_HEIGHT);
    	
    	components = new Component[]
    	{
    		new CollisionComponent(this)	
    	};
    }
    
    @Override
    public void update()
    {
    	//TODO: possibly make this in a physics component?
    	if(velocity.y > MAX_GRAVITY)
    		velocity.add(0, -9.8f * Time.getDeltaTime());
    	
    	super.update();
    }
}
